-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Enhancement of split op with indices option #13564
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we adding the documentation about indices?
size_t idx = i / trailing_size % axis_size; | ||
size_t target = 0; | ||
for (size_t section = 0; section < num_sections; target = section++) { | ||
if (indices[section] > idx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do preincrement (++section) as standard C++ idiom and assign target somewhere less ofuscated?
src/operator/slice_channel-inl.h
Outdated
} | ||
} | ||
DType* target_data = out_data[target]; | ||
size_t mid_idx = idx - indices[target]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they can be const
src/operator/slice_channel-inl.h
Outdated
} | ||
} | ||
DType* src_grad = out_grad[src]; | ||
size_t mid_idx = idx - indices[src]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be const
} | ||
|
||
private: | ||
SliceChannelParam param_; | ||
int size_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this and num_outputs be size_t?
@larroy Docs for indices already added: /~https://github.com/apache/incubator-mxnet/pull/13564/files#diff-45b9e096a484a102b0f797a2f8817361R56 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution HyperZealot. I added some minor comments to make the code more maintainable.
I don't see the docs that you linked. Could you please relink? |
@larroy the string in the |
Thanks, to be specific about my question, you added an "indices" parameter but you didn't add that to the example code which you modified at the bottom of your patch. Would it make sense to use this added parameter in the examples? |
ca9afc3
to
be519d1
Compare
@larroy There was a typo in the example, the |
e4c9a61
to
4e0719b
Compare
4e0719b
to
01072e9
Compare
@HyperZealot Thanks for the contribution. Can you look into failing builds so that we can move forward with this PR? |
@HyperZealot Update [pr-awaiting-response] |
@HyperZealot can you please address the comments. |
Description
Support split by arbitrary ranges through addition of indices option.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments